
These are the replication files for: 

Rathbun, Brian, Christopher Sebastian Parker, and Caleb Pomeroy "Separate but Unequal: Ethnocentrism and Racialization Explain the 'Democratic' Peace in Public Opinion," American Political Science Review.


Scripts included -----

1. "johns_davies_reanalysis_rep.R" reproduces our re-analyses of Robert Johns and Graeme Davies (2012) "Democratic Peace or Clash of Civilizations? Target States and Support for War in Britain and the United States," Journal of Politics.

2. "tomz_weeks_reanalysis_rep.R" reproduces our re-analyses of Michael Tomz and Jessica Weeks (2013) "Public Opinion and the Democratic Peace," American Political Science Review.

3. "qualtrics_survey_analysis_rep.R" reproduces the Qualtrics survey results presented in the main text and appendices.

4. "prolific_survey_analysis_rep.R" reproduces the Prolific survey results presented in the main text and appendices.

5. "embedding_analysis_rep.R" reproduces the word embedding analyses presented in the main text and appendices.

6. "dafoe_etal_reanalysis.R" reproduces our re-analyses of Allan Dafoe, Baobao Zhang, and Devin Caughey (2018) "Information Equivalence in Survey Experiments," Political Analysis. We used this data to help determine the country attributes to "fix" in our original survey experiments, in order to address further information equivalence issues.


Data included -----

1. "johns_davies.rds" includes the relevant variables used in our re-analyses of Johns and Davies (2012).

2. "tomz_weeks.rds" includes the relevant variables used in our re-analyses of Tomz and Weeks (2013).

3. "qualtrics_survey.rds" includes data from our original Qualtrics survey.

4. "prolific_survey.rds" includes data from our original Prolific survey.

5. "glove_200d_vectors.rds" includes the pretrained GloVe vectors in 200 dimensions. For more, see: Pennington, J., Socher, R., & Manning, C. D. (2014, October). Glove: Global vectors for word representation. In Proceedings of the 2014 conference on empirical methods in natural language processing (EMNLP) (pp. 1532-1543).

6. "glove_300d_vectors.rds" includes the pretrained GloVe vectors in 300 dimensions, as a robustness check (see above). 

7. "uk_elite_vectors.rds" includes vectors locally trained on Hansard texts using the GloVe model. We obtained the raw texts from: Goet, N. D. (2019). Measuring polarization with text analysis: Evidence from the UK House of Commons, 1811–2015. Political Analysis, 27(4), 518-539. 

8. "dafoe_etal.rds" includes the relevant variables used in our re-analyses of Dafoe et al (2018).


Replication process -----

1. Ensure there's a top-level folder "replication_files" (or whatever you'd like to call it), which contains a "scripts" folder and a "data" folder. The "scripts" folder contains the R scripts. The "data" folder contains the datasets. Note: we provide the word embedding data in a separate "embedding_data" folder on Dataverse, given the size of these files (~1 GB). If you would like to reproduce the word embedding analysis, be sure to download that folder and move the three embedding .rds files to the "data" folder.

2. Set your working directory in R to the location of the top-level folder containing the replication files.

3. Install the necessary packages listed at the top of the scripts, if they aren't already installed.

4. The scripts are self-contained analyses, so you can run them in any order. 


Version details -----

-All analyses carried out using R version 4.3.1, R studio version 2023.6.1.524, on a MacBook Pro (M1, 8GB RAM).

-Package versions: conText (1.4.3), DirectEffects (0.2.1), dplyr (1.1.2), estimatr (1.0.0), ggeffects (1.2.3), ggplot2 (3.4.2), lsa (0.73.3), ltm (1.2-0), plyr (1.8.8), psych (2.3.6), reshape2 (1.4.4), texreg (1.38.6).


